<?php 
//**********************************************************
// VOTE SCRIPT MADE BY AXE
// do not remove this notice, this is free software
//***********************************************************
include "../inc-config.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-type" content="text/html; charset=UTF-8"><title>Vote for <?php print "$sitetitle" ?></title>
<link rel="stylesheet" href="google_style.css">
<link rel="stylesheet" href="landingPageActionFrame.css">
<meta name="description" content="wow private server, mystika wow, horde, alliance, bloodelf, bc, tbc, zulaman">
<script type="text/javascript" src="frame-js.js"></script>
<?php
$user = $_SESSION['user'];
$GetUserInfo = "SELECT * FROM b_users WHERE username='$user'";
$GetUserInfo2 = mysql_query($GetUserInfo, $forum) or die("Error #1: " . mysql_error());
$GetUserInfo3 = mysql_fetch_array($GetUserInfo2);



if(isset($_GET['vote']))
 {
    $voteurl0=$_GET['vote'];
	$voteurl= ereg_replace("%26","&", $voteurl0);
			switch ($voteurl) {
		     case $voteurl1:
			       $siteid = '1';
			       break;
			 case $voteurl2:
			       $siteid = '2';
			       break;
		     case $voteurl3:
			       $siteid = '3';
			       break;
		     case $voteurl4:
			       $siteid = '4';
			       break;
			  case $voteurl5:
			       $siteid = '5';
			       break;
			 default: $siteid='0';
			 }  
		   
 } else 
 {
   $voteurl = "error.php";
   $siteid='0';
 }
 
$GetVoteInfo = "SELECT * FROM b_vote WHERE userid='$GetUserInfo3[userID]' AND siteid='$siteid'";
$GetVoteInfo2 = mysql_query($GetVoteInfo, $forum) or die("Error #2: " . mysql_error());
$GetVoteInfo3 = mysql_fetch_array($GetVoteInfo2);
$rep = $GetUserInfo3['honours'] + $voterep;
$points = $GetUserInfo3['points'] + $votepoint;
$buff = $GetUserInfo3['buff'] + 1;
$money = $GetUserInfo3['money'] + 5000;
$timenow = date("U");
$timefuture = date("U")+43200;//12 hrs
$timeleft = $GetVoteInfo3['timevoted'];
$timeleft2 = gmdate("F j, Y G:i:s", $timeleft); //ex: March 23, 2009 18:25:55 - gmdate so its UTF
$timeleft3 = $GetVoteInfo3['timevoted'] - $timenow;
if ($siteid=='0') {
	$text="That site is not in database.";
}
else {
	if ($GetUserInfo3[userid] == $GetUserInfo3['userID'] && $siteid == $GetUserInfo3['siteid'] && $GetUserInfo3['timevoted'] >= $timenow)
	{
		$text = "No rep's or points will be gained. Come back again in $timeleft3 seconds. Follow instructions below to vote.";// 
	}
	else
	{
	$text = "Follow instructions below to vote and you will gain +$voterep rep's, +$votepoint point, +15s, +1 buff point. You can vote again in 12 hours. Thank you!";
	$adding = "UPDATE b_users SET honours='$rep', points='$points', buff='$buff', money='$money' WHERE username='$user'";
	mysql_query($adding, $forum) or die("Error #3: " . mysql_error());
	
	$ins="INSERT INTO b_vote (userid,siteid,timevoted) values ('$getuser3[userID]','$siteid','$timefuture')";
	mysql_query($ins, $forum) or die("Error #4: " . mysql_error());
	
	$del="DELETE FROM b_vote WHERE timevoted < '$timenow'";
	mysql_query($del, $forum) or die("Error #5: " . mysql_error());
	}
} 
?>
<script type="text/javascript" language="javascript">

function init() {
  _lpaf_onResize();
 
  initPicker();
</script>
</head>  
<body onLoad="_lpaf_onResize()" onResize="_lpaf_onResize()">

   <div id="lpaf_framefull" class="lpaf_framefull"><table class="lpaf_toprow"><tbody><tr>
     <td><a href="../home.php">Go back to Main Page</a></td>
	 <td align="center" style="color:#FFFFFF">
	 
	 <?php 
	 if (isset($_SESSION['user']))
	 {
		echo $text; 
	 }
	 else
	 {
		echo "You are not logged in. Follow instructions below to vote. <a href='../forum/login.php'>Login</a>"; 
	 }
	 ?>
	 
	 
	 </td>
     <td class="collapse_td"><span id="collapse_link" style="display: none;"><a href="javascript:_lpaf_collapse();">Collapse Frame</a></span>
<span id="collapse_lin"><a href="<?php print "$voteurl";?>">Remove Frame</a></span></td></tr></tbody></table>

</div></div>

<iframe id="3rdPartyFrame" name="3rdPartyFrame" style="position: relative; z-index: 10; width: 100%; height:560px" src="<?php print "$voteurl";?>" frameborder="0" scrolling="auto"></iframe>

<noscript>
<p>Web Page  requires JavaScript to be enabled for full
functionality.</p> 
</noscript></body></html>